<html>
<head>
    <script src="/js/validate.js" type="text/javascript"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="background-color: transparent">
<form id="id-form" name="frm" method="post" action="/danhsachcongty/danhsachcongty/save" enctype="multipart/form-data">
    <input type=hidden name="id" value="<?=$this->data[i];?>" />
   
        <table >
         <tr>
        	<td>
        	Tên công ty
        	</td>
        	<td>
        	<input class="inp-form" id="idName" name="name" value="<?=$this->data[name]; ?>" type="text"  size="30"/>
        	</td>
            <td nowrap="nowrap"></td>
        	<td>        	
        	</td>
        </tr>
           <tr>  	
        	<td nowrap="nowrap">Địa chỉ Email<font color="red">*</font></td>
        	<td>
        	<input class="inp-form" id="iEmail" name ="email" value="<?=$this->data[email];?>" type ="text" size ="30" maxlength="50">
        	</td>
        	<td>
        	Địa chỉ Website
        	</td>
        	<td>
        	<input class="inp-form"  id="idWeb" name ="website" value="<?=$this->data[website];?>" type ="text" size ="30" maxlength="50">
        	</td>
        </tr>
         <tr>  	
        	<td nowrap="nowrap">Hình ảnh công ty<font color="red">*</font></td>
        	<td>
                    <input type="file" name="image" style="width:100px"/>
             </td>
        	<td nowrap="nowrap">Ngày tạo<font color="red">*</font></td>
        	<td>
        	<input class="inp-form" id="idCreationdate" name ="creation_date" value="<?=$this->create_date;?>" type ="text" size ="30" maxlength="50">
        	</td>
        	<?php common::datePicker('idCreationdate'); ?>
        </tr>
         <tr>  	
        	<td>
        	Địa chỉ yahoo
        	</td>
        	<td>
        	<input class="inp-form" id="idyahoo_id" name ="yahoo_id" value="<?=$this->data[yahoo_id];?>" type ="text" size ="30" maxlength="50">
        	</td>
        	<td nowrap="nowrap">Địa chỉ skype<font color="red"></font></td>
        	<td>
        	<input class="inp-form" id="idskype_id" name ="skype_id" value="<?=$this->data[skype_id];?>" type ="text" size ="30" maxlength="50">
        	</td>
        </tr>
        <tr>  	
        	<td>
        	Kích hoạt
        	</td>
        	<td>
        	<input type="checkbox"  <?php if ($this->data[status] == 1) echo "checked";?>  value="1" name="kichhoat" />
        	</td>
        </tr>
   		</table>
    <input type=hidden name="id" value="<?= $this->data[id]; ?>" />
</form>
<Script language="JavaScript">
function validateDmy(isField){
    splitDate = isField.value.split("/");
    if (splitDate[2] && splitDate[2].length == 2){
        splitDate[2] = "20"+splitDate[2]
    }
    refDate = new Date(splitDate[1]+"/"+splitDate[0]+"/"+splitDate[2]);
    if (splitDate[1] < 1 || splitDate[1] > 12 || refDate.getDate() != splitDate[0] || splitDate[2].length != 4 || (!/^20/.test(splitDate[2])))
    {
        return false;
    }
    return true;
}
    function  save(){
        var flag=0;
    	var vldate= document.getElementById('idCreationdate');
    	if(!validateDmy(vldate)){
        	alert('Nhập ngày không đúng định đạng dd/mm/yyyy');
        	flag=1;
        	return;
        	}else{
        		flag=0;
            	}
    	if(flag==0){
    		document.frm.submit();
        	}
    	else{
        	return;
        	}
            
    }

    function back(){
        document.location.href='/danhsachcongty/danhsachcongty/index';
    }
</Script>
</body>
</html>